﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
using Crossroad.Core.Helper;
using Crossroad.Core.Models;
using Crossroad.System.Admin.Model;

namespace Crossroad.System.Admin.Service
{
	/// <summary>
    /// 计量单位
    /// </summary>
    public interface IUnitService: IRelevantData<Unit>
    {

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="method"></param>
        /// <param name="loadRelevantData">是否加载关联数据</param>
        Pagination<Unit> GetPaging(
            int pageIndex,
            int pageSize,
            Action<ISugarQueryable<Unit>> method,
			bool loadRelevantData = true
        );

        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="method"></param>
        /// <param name="loadRelevantData">是否加载关联数据</param>
        /// <returns></returns>
        List<Unit> GetList(
            Action<ISugarQueryable<Unit>> method,
			bool loadRelevantData = true
        );

        /// <summary>
        /// 查询详情
        /// </summary>
        /// <param name="method"></param>
        /// <param name="loadRelevantData">是否加载关联数据</param>
        /// <returns></returns>
        Unit GetEntity(
            Action<ISugarQueryable<Unit>> method,
			bool loadRelevantData = true
        );

        /// <summary>
        /// 查询详情
        /// </summary>
        /// <param name="id"></param>
        /// <param name="loadRelevantData">是否加载关联数据</param>
        /// <returns></returns>
        Unit GetEntity(int id, bool loadRelevantData = true);

        /// <summary>
        /// 根据id列表查询maps
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        Dictionary<int, Unit> GetMaps(List<int> idList);

        /// <summary>
        /// 新增返回详情
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Unit CreateAt(Unit model);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        Unit UpdateAt(Unit model);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="source"></param>
        void DeleteAt(Unit source);


    }
}

